﻿using Mozhi.Abp.Core.Extensions;
using Mozhi.Abp.Core.Networks;
using Mozhi.Abp.Domain.BasicData;
using Mozhi.Abp.Domain.BasicData.Repositories;
using Mozhi.Abp.Infrastructure.RemoteRepositories;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;

namespace Mozhi.Abp.Domain.Repository.BasicData.RemoteRepositories
{
    public class OrganizationRepository : RemoteRepository<Organization>, IOrganizationRepository
    {
        public OrganizationRepository(IRemoteServiceClient remoteServiceClient) : base(remoteServiceClient, "BasicData", "api/v1/organizations")
        {
        }

        public async Task<Organization> GetAsync()
        {
            if (_url.IsNullOrEmpty())
                throw new ArgumentNullException("url");

           
            var entity = await _remoteServiceClient.GetAsync<Organization>(_serviceName, _url);

            return entity;
        }

       
    }
}
